package com.ziven.common.widget.value;

import android.view.View;

import androidx.annotation.NonNull;

import com.ziven.easygo.util.ViewHelper;

/**
 * @author Ziven
 */
public final class BooleanValue extends Value {

    public static BooleanValue ofTrue() {
        return new BooleanValue(true);
    }

    public static BooleanValue ofFalse() {
        return new BooleanValue(false);
    }

    private BooleanValue(boolean value) {
        this.value = value;
    }

    public void not() {
        if(isTrue()) {
            this.value = false;
        } else {
            this.value = true;
        }
    }

    public boolean isTrue() {
        return value(Boolean.class);
    }

    public boolean isFalse() {
        return !isTrue();
    }

    @Override
    protected void takeEffect(@NonNull ViewHelper<? extends View> helper) {
        //Do nothing
    }
}
